/**
 * 路由拦截器
 */
import router from './router'
import store from './store'
const withePath = ['/login', '/register']
router.beforeEach((to, from, next) => {
    if (withePath.includes(to.path)) {
        next()
    } else {
        if (store.getters.token) {
            // if (store.getters.menuList.length === 0) {
            //     store.dispatch('getMenuList').then(() => {
            //         next({ ...to, replace: true })
            //     }).catch(() => {
            //         next('/login')
            //     })
            // }
            next()
        } else {
            next('/login')
        }
    }
})